using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FShop.BAL;

public partial class Controls_TopProductImage : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //string strTemp = "<a class='dock-item' href='Default.aspx?Pro_ID={0}'><img src='images/product/{1}' alt='{2}' /><span>{3}</span></a>";
            string strTemp = "<a class='dock-item' href='ProductDetail.aspx?Cate_ID={0}&Product_ID={1}'><img src='images/product/{2}' alt='{3}' /></a>";
            string strLabel = "";
            string cate_ID = Request.QueryString["Cate_ID"];
            string sWhere = "";
            if (!string.IsNullOrEmpty(cate_ID))
            {                
                sWhere = "Cate_ID="+cate_ID;
            }            
            DataTable tbl = Product_BAL.Get_ProductAsPaging(1, 8, "Pro_ID DESC", "*",sWhere,"");
            foreach (DataRow r in tbl.Rows)
            {
                //string temp = string.Format(strTemp, new object[] { r["Pro_ID"].ToString(), r["Pro_Image"].ToString(), r["Pro_Name"].ToString(), r["Pro_Name"].ToString() });
                string temp = string.Format(strTemp, new object[] { r["Cate_ID"].ToString(), r["Pro_ID"].ToString(), r["Pro_Image"].ToString(), r["Pro_Name"].ToString() });
                strLabel += temp;
            }
            lblTopProduct.Text = strLabel;
        }
    }
}
